<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>我的任务挂起</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
        <div>
        	<div class="searchArea">
					    <form id="searchBar">
					        <div class="fieldset1 clearFix">
					            <div class="fieldBox">
					                <div class="label" style="width: 60px;">文件名称</div>
					                <div class="field">
					                    <input name="fileNm" id="fileNm" type="text" class="ui-textbox" value="">
					                </div>
					            </div>
					            <div class="fieldBox">
					                <div class="label" style="width: 60px;">维护者</div>
					                <div class="field">
					                    <input name="crtUsrRlNm" id="crtUsrRlNm" type="text" class="ui-textbox" value="">
					                </div>
					            </div>
					            <div class="fieldBox">
							              <div class="label">上传时间</div>
							              <div class="field">
							                  <input ligerui="width: 82" name="crtTmstart" id="crtTmstart" type="text"
							                         class="ui-datepicker" value="" validate="{required:true}"  >
							             -
							             <input ligerui="width: 82" name="crtTmend" id="crtTmend" type="text"
							                    class="ui-datepicker" value="" validate="{required:true}">
							         </div>
							     </div>
					            
					            <div class="fieldBox">
					                <div class="label" style="width: 60px;">状态</div>
					                <div class="field">
					                    <select name="isDel" id="isDel">
					                       <option value="" seleted>请选择</option>
					                       <c:forEach items="${isDel}" var="item">
					                        	<option value="${item.key }">${item.value }</option>
					                       </c:forEach>
					                    </select>
					                </div>
					            </div>
								           
					            <div class="clearFix"></div>
					            <div class="btnsBox">
					               <span id="searchBtn" class="sq-button sq-button-round">查询</span>
					               <span onclick="clearBtn();" class="sq-button sq-button-round">清空</span>
					               <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
					            </div>
					        </div>
					    </form>
			</div>
            <div id="ligergridGQ" class="sq-grid"></div>
        </div>
    </div>

<script type="text/javascript">
	var gridGQ = null;
	var pageInApp={}; // to 下一级子窗口 接口
    var pageInTab=null;
    var loadedTabs=[]
	$(function () {
		initGridGQ();//初始化挂起列表
	
	    $("#searchBar").ligerForm();
	
	    $("#searchBtn").click(function(event) {
	    	reloadGrid();
	    });
	});


    
    //重新加载数据
    function reloadGrid(){
    	var form = new liger.get("searchBar");
        var data = form.getData();
      
        //业务类型要名字 businessType
        var _businessType = $("#businessType").val();
        var _businessTypeName = $("select[name=businessType] option[value='"+_businessType+"']").text();
        if(_businessTypeName == "请选择"){
        	_businessTypeName = "";
        }
        data["businessType"] = _businessTypeName;//用中文作为查询条件
        for (name in data){
	        gridGQ.setParm(name,data[name]);
	     };
	     gridGQ.reload();
    }
    
  	//初始化挂起列表
    function initGridGQ(){
    	$("#ligergridGQ").ligerGrid({
	    	url: '<%=path%>/bizflow/rskUsrAchLog/initMyAchievementslSList.do',
	    	method : 'get',
	        columns: [
	                  { display: '文件', name: 'fileNm',  width: 180, enabledSort:false,
	            	
	                render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
	            },
	            { display: '上传时间', name: 'crtTm',  minWidth: 100, enabledSort:false,render: renderDate},
	            { display: '维护者', name: 'fileRem',  width: 120, enabledSort:false},
	            { display: '状态', name: 'isDel',  width: 100, enabledSort:false,
	            	render: function (rowdata, rowindex, value){
  	        			if(value==0){
  	        				return rowdata.isDel="启用";
  	        			}else{
  	        				return rowdata.isDel="作废";
  	        			}
  	            	}
	            },
	            getOperColumn()
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-30,
	        checkbox:true,
	        rownumbers:true
	    });
    	gridGQ = liger.get("ligergridGQ");
    	gridGQ.setHeight(100);
    	gridGQ.options.isSingleCheck=true;
    }
  	
    //获取最后操作列
    function getOperColumn(){
    	return {
            display: '操作',
            width: 80,
            align:'left',
            render: function (rowdata, rowindex, value) {
            	//如果assignee为空则显示签收按钮
            	var other= "";
            	other+='<a id="grid_row_private_btn_id" class="sq-button-hasicon" href="javascript:;" onclick="recoverRow(';
       		 	other+="'"+rowindex+"'";
                other+=")\"><i class=\"sqBtnIco_5\"></i>"+LogUtils.LOG_CMM_GRID_BTN_ZF+"</a>";
                return other;
            }
        };
    }
	
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
		}
		return dateStr;
	}
	function uploadFileByUrl(_url,_name){
		if(SQ.regs.img.test(_name)){
		}else{
	        window.open(_url);
		}
    }
	

	
	
	//作废
	function recoverRow(_index){
		var rowdata = gridGQ.rows[_index];
		var _id = rowdata.id;
		var parms = "files_id="+_id;
		var _url = '<%=path%>/bizflow/rskUsrAchLog/modifyStart.do';
		AjaxUtils.ajaxPost(_url, parms, function(msg){
			if(msg.success == 1){
				 UIUtils.alertSuccess(msg.info);
				 reloadGrid();
			 }else{
				 UIUtils.alertError(msg.info);
			 }
		},true);
	}
	function clearBtn(){
		$("#resetBtn").click();  //重置 input-text
		var form = liger.get("searchBar");
		$("#orgCd").val(" ");
        form.setData({  //重置select等特殊表单
            "businessType":" ",
            "bizResCd":" "
        });
	}
	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    };
	}
</script>

</body>
</html>